import java.util.Random;

//Map情報はここから作るようにしました

public class CreateMap {
	protected int map[][];
	protected final int colorVal = 7;
	Random random = new Random();

	CreateMap() {
		map = new int[8][8];
		for (int i = 0; i <= 7; i++) {
			for (int j = 0; j <= 7; j++) {
				changeMap(i, j);
				if (j > 1) {
					if (map[i][j - 1] == map[i][j - 2]) {
						while (map[i][j] == map[i][j - 1]) {
							changeMap(i, j);
						}
					}
				}
				if (i > 1) {
					if (map[i - 1][j] == map[i - 2][j]) {
						while ((map[i][j] == map[i - 1][j])) {
							changeMap(i, j);
							if (j > 1) {
								while (map[i][j] == map[i][j - 1]) {
									changeMap(i, j);
								}
							}
						}
					}
				}
			}
		}
	}

	public void changeMap(int i, int j) {
		int rand = random.nextInt(colorVal);
		map[i][j] = rand;
	}

}

